<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Document</title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	
	<link rel="stylesheet" type="text/css" href="../../css/mui.min.css"/>
	<link rel="stylesheet" type="text/css" href="../../css/tt/list-table-cell.css"/>
	<link rel="stylesheet" type="text/css" href="../../css/comm.css"/>
	<style type="text/css">
		.top-content{
			margin-top: 15px;
			margin-left: 0px;
			margin-right: 0px;
			/* text-indent: 2px; */
			color: #333333;
		}
		.mui-grid-view.mui-grid-9 .mui-table-view-cell {
			margin: 5px 0 0 0;
			padding: 0px 0px;
			vertical-align: top;
			border-right: 0px solid #eee;
			border-bottom: 0px solid #eee;
			border-left: 0;
			border-top: 0;
			border-width: 0;
			background-color: white;
		}
		.mui-grid-view.mui-grid-9 {
			margin: 0;
			padding: 0;
			border-top: 0px solid #eee;
			border-left: 0px solid #eee;
			background-color: #f2f2f2;
		}

		.list-image{
			width: 100px;
			height: 100px;
			background-repeat:no-repeat; 
			background-size:100% 100%;
			/* display: inline-block; */
			margin-right: 0px;
			margin-top: 5px
		}
		.single-image{
			width: 100px;
			height: 100px;
			background-color: white;
			padding: 0px;
			/* margin-right: 5px; */
			border-radius: 2px;
			margin-bottom: 0;
			padding-bottom: 0;
		}
		
		.image-wrap{
			margin-top: 0px;
			margin-right: 5px;
			display: inline-block;
			margin-bottom: 0;padding-bottom: 0;
		}
		
		.bottom-bar{
			background-color: #fff;
			border-top-width: 1px;
			border-top-style: solid;
			border-top-color: #eee;
			height: 50px;
			position: fixed;
			bottom: 0;
			width: 100%;
		}
		
		[v-cloak] {
		  display: none;
		}

	</style>
</head>
<body style="background-color: white;">
<div class="mui-content" style="background-color: white;padding-bottom: 20px;margin-bottom: 50px;">
	<div id="base-info-id" style="margin-left: 15px;margin-right: 15px;margin-top: 20px;" v-cloak>
		<img v-on:click="openHomePage" v-bind:src= avatar class = "avatar-icon" style="border-radius: 20px;width:40px;">
		<div style="margin-left: 6px;">
			<div style="margin-top: 0px;color: #666;font-size: 15px;margin-left: 45px;margin-top: 0px;margin-bottom: 0px;height: 20px;">
				{{user_name}}
			</div>
			<div style="margin-left: 20px;display: inline-block;color: #8f8f94;font-size: 12px;margin-left: 15px;">
				{{postDate}}</div>
		</div>
		
		<!-- 动态内容，不同的类型格式不同 -->
		<div id="post-info-id" class="mui-media-body">
			<!-- <div class="top-content" style="white-space: pre-wrap;padding-left: 10px;">{{item.content}}</div> -->
		</div>
		<!-- 动态内容，不同的类型格式不同 -->
		
		<div v-if="images.length > 0" id="image-list" style="margin:8px 5px 8px 10px;"></div>
		<div style="margin-top: 8px;margin-left: 10px;">
			<div style="color: darkgray;font-size: 12px;display: inline-block;">{{item.readCnt}}阅读</div>
			<div @tap="zanAction();" style="display: inline-block;float: right;margin-right: 50px;font-size: 12px;color: #808080;">
				<img id="zan-icon-id" src="../../images/comment_like_icon_normal@2x.png" width="20px" height="20px" style="margin-top: 2px;margin-bottom: -6px;" >
				<div id="zan-number-id" style="display: inline-block;"></div>
			</div>
			
			<div style="margin-top: 10px;font-size: 12px;color: #888888;padding: 5px 5px;">
				提示: 平台不对该信息承担任何责任，若发现虚假信息等违法行为请<span v-on:click="connectUsAction(0)" style="color: #FF4500;padding: 5px 0;">举报</span> 或者<span v-on:click="connectUsAction(1)" style="color: #FF4500;padding: 5px 0;">联系我们</span>删除
			</div>
			
		</div>

		<div style="margin-top: 10px; margin-left: -15px;margin-right: -15px; border-width: 0; border-width: 8px 0 1px 0;border-color: #F0F0F0;border-style: solid;padding: 10px 15px;font-size: 15px;color: #666666;">
			评论	
		</div>	
	</div><!-- 动态内容 -->

	<!-- 评论列表 -->
	<div id="comment-list-id" v-cloak>
		<ul  v-if="items.length > 0"   class="mui-table-view" >
			<li class="mui-table-view-cell" v-for="item in items">
				<a >
					<img v-on:click.stop="openHomePage(item)" v-bind:src = "item.avatar_thumb || '../../images/default_avatar.png'"  class = "avatar-icon" style="border-radius: 15px;width:30px;height: 30px;margin-top: 3px;">
					
					<div v-bind:id="item.id" @tap="commentZanAction($event ,item)" style="display: inline-block;float: right;margin-right: 20px;font-size: 12px;color: #808080;">
						<img v-if="item.isPraised > 0" src="../../images/comment_like_icon_press@2x.png" width="15px" height="15px" style="margin-top: 2px;margin-bottom: -2px;" >
						<img v-else src="../../images/comment_like_icon_normal@2x.png" width="15px" height="15px" style="margin-top: 2px;margin-bottom: -2px;" >
						<div v-if="item.praise > 0" style="display: inline-block;">{{item.praise}}</div>
					</div>
					
					<div style="margin-top: 5px;">
						<div style="color: #5e86c1;font-size: 14px;margin-left: 40px;margin-top: 0px;margin-bottom: 0px;height: 20px;">
							{{item.user_name}}
						</div>
						
						<div class="mui-media-body">
							<div class="top-content" style="white-space: pre-wrap;padding-left: 5px;font-size: 16px;margin-top: 10px;text-indent: 0px;">{{item.content}}</div>
						</div>
						
		<!-- 				<div @tap="tableViewDidClick(item)" style="margin-left: 35px; margin-top: 8px; display: inline-block;color: #666;font-size: 12px;">
							{{item.postDate}} <span style="margin-left: 10px;">回复</span> 
						</div> -->
						<div style="margin-left: 35px; margin-top: 8px; display: inline-block;color: #666;font-size: 12px;">
							{{item.postDate}} <span style="margin-left: 10px;"></span> 
						</div>
						
						<!-- 删除自己的评论 -->
						<div v-if="isMyPost(item)" @tap="deleteMyComment(item);" id="delete-my-comment"  style="float: right; margin-right: 20px; margin-top: 8px; display: inline-block;color: #666;font-size: 12px;padding: 0 5px;">
							删除
						</div>
						<div v-else @tap="jubaoComment(item);" id="jubao-other-comment"  style="float: right; margin-right: 20px; margin-top: 8px; display: inline-block;color: #666;font-size: 12px;padding: 0 5px;">举报
						</div>
						
					</div>
				</a>
			</li>
		</ul>
		<div v-else style="text-align: center;font-size: 14px;margin-top: 50px;color: darkgray;">
			暂无评论
		</div>
	</div>
	
	<div id="bottom-bar-id"  class="bottom-bar"  v-cloak>
		<div  style="margin-top: 5px;margin-left: 15px;" >
			<button id="write-comment-id" type="button" style="font-size: 12px;border-width: 0;background-color: #FFFFFF;">
				<div style="display: inline-block;">
					<img src="../../images/write_icon@2x.png" width="20px" height="20px" style="margin-top: 2px;margin-bottom: -3px;">
				</div>
				<div style="margin-left: 6px;display: inline-block;color: #808080;">写评论</div>
			</button>
			
			<div style="display: inline-block;margin-top: 10px;margin-left: 6%;">
				<img src="../../images/tab_comment@2x.png" width="22px" height="22px" style="margin-bottom: -8px;">
				<div v-if="item.cnt > 0" id="comment-cnt-bandge" style="display: inline-block; background-color: #FF5053;color: white;font-size: 10px;margin-left: -15px;padding: 0px 6px; border-radius: 6px;height: 15px;">
					{{item.cnt}}
				</div>
			</div>
			
			<div id="sc-button-id" style=" margin-left: 10%; display: inline-block;font-size: 12px;color: #808080;">
				<img v-if="item.issc > 0" src="../../images/likeicon_actionbar_details_press@2x.png" width="20px" height="20px" style="margin-top: 12px;margin-bottom: -6px;" >
				<img v-else src="../../images/likeicon_actionbar_details@2x.png" width="20px" height="20px" style="margin-top: 12px;margin-bottom: -6px;" >
				<div v-if="item.issc > 0" style="display: inline-block;">取消收藏</div>
				<div v-else style="display: inline-block;">添加收藏</div>
			</div>
			
			<div id="share-id" style="display: inline-block;margin-right: 0px; float: right;margin-right: 40px;">
				<img src="../../images/share_icon@2x.png" width="25px" height="25px" style="margin-top: 8px;" >
			</div>
		</div>
	</div>
	
</div>

<script src="../../js/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/p/vue.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/p/date.formatter.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/p/open.page.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/p/hud.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/p/api.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/p/user.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	var postInfo = {}//动态详情信息
	var category;//动态类型 sy ,zt ,life
	var commentPageNum = 1;
	var issc = false;//是否收藏
	var iszan = false;//是否点赞
	var _myId = getLoginUid();
	//分享相关定义
	var shares=null;
	var shareUsername = '';
	var shareUserid = '';
	var shareContent = '';
	var shareTitle = '';
	
	mui.init()
	
	///动态赞,不能取消
	function zanAction(){
		if(!userHasLogined()){hud_toast('请先登录');return;}
		
		if(iszan){mui.toast('已经赞过!');return;}
		var d = {"pid":postInfo['pid'] , 
		"type":"1" ,
		"postby":postInfo['uid'] , //发布者
		"uid":_myId,//评论者
		"category":category , 
		"postContent":postInfo["content"]}
		
		hud_show('请求中');
		api_post(detail_url ,d,function(res){
			iszan = !iszan;
			setZanIcon(iszan);
			hud_close('点赞成功');
		},function(error){
			hud_close(error);
		})
	}
	
	function setZanNumber(num){
		var zanCnt = document.getElementById('zan-number-id');
		if(zanCnt){
			zanCnt.innerText = num;
		}
	}
	
	function setZanIcon(isPraise){
		var zanIcon = document.getElementById('zan-icon-id');
		zanIcon.setAttribute('src' , isPraise ? "../../images/comment_like_icon_press@2x.png" : "../../images/comment_like_icon_normal@2x.png");
	}
	
	//评论点赞
	function commentZanAction(obj , item){
		if(!userHasLogined()){hud_toast('请先登录');return;}
		
		var _srcId = obj.currentTarget.id;//目标元素ID
		//console.log(obj.type);//事件类型
		var _div0 = document.getElementById(_srcId);
		var _img = _div0.getElementsByTagName('img')[0];
		if(_img){
			var now_icon = _img.src;
			var isliked = now_icon.indexOf('comment_like_icon_press') != -1;
			if(isliked){mui.toast('已经赞过!');return;}
			
			var d = {"pid":item['id'] , //后台不验证动态是否存在 ，评论ID
			"type":"1" ,
			"postby":item['uid'] , //发布者
			"uid":_myId,//评论者
			"category":category , 
			"postContent":item["content"],
			'iscommentpraise':1}
			
			hud_show('请求中');
			
			console.log(JSON.stringify(d));
			
			api_post(detail_url ,d,function(res){
				isliked = !isliked;
				
				_img.setAttribute('src' , isliked ? "../../images/comment_like_icon_press@2x.png" : "../../images/comment_like_icon_normal@2x.png");
				
				hud_close('点赞成功');
			},function(error){
				hud_close(error);
			})
		}
		
		//console.log(JSON.stringify(item));
	}
	
	//删除评论
	function deleteMyComment(item) {
		plus.nativeUI.confirm('确定删除这条评论?' , function(e){
			if(e.index == 0){
				var d = {"type":"delete","id":item['id'] , "uid":_myId};
				hud_show('删除评论');
				api_post(comment_url , d , function(res){
					hud_close('删除评论成功');
					
					//删除自己的评论后刷新列表
					var w = plus.webview.currentWebview();
					mui.fire(w , 'refresh-comment-event');
				},function(err){
					hud_close(err);
				})
			}
		},{title:'提示' , buttons:['确定' , '取消']});
	}
	function jubaoComment(item){
		var d = {"pid":item['id'],"category":'comment'};		
		openNewPage('../publish/pub-jubao.html' , '举报评论' , true , {'info':d});
	}
	
	//是否自己的评论
	function isMyPost(item){
		var _uid = item['uid'];
		return _uid == _myId;
	}
	
	//回复评论
	function tableViewDidClick(item){
		if(!userHasLogined()){hud_toast('请先登录');return;}
		
		openNewPage('../comment-list.html','评论回复',true , {'originItem':item});
	}
	
	mui.plusReady(function () {
	    var w = plus.webview.currentWebview();
		postInfo = w.item;
		category = w.category;
		
		console.log(category);
		
		//内容信息
		var baseInfo = new Vue({
			el:'#base-info-id',
			data:{
				item: {
					user:{}
				}
			},
			computed:{
				user_name:function(){
					var d = this.item;
					var user = d['user'];
					var uname = user["name"] || user['nickName'];
					return uname;
				},
				avatar:function(){
					//这里会调用多次,第一次是为空值,暂未处理....
					var d = this.item;
// 					console.log('-------');
					// console.log(JSON.stringify(d));
					var u_avatar = d['user']['avatar_thumb'] || "../../images/default_avatar.png";
					u_avatar = u_avatar.indexOf('http') != -1 ? u_avatar : "../../images/default_avatar.png";
					return u_avatar;
				},
				postDate:function(){
					var d = this.item;
					var s = d['postDate'];
					if(!s)return;
					
					var t = dateUtils.format(s);
					return t;
				},
				images:function(){
					//添加图片	
					var d = this.item;
					var igStr = d['images'];
					if(igStr != null && igStr.length > 0){
						// if(d['imageNum'] == '1'){
						var igurlArr = igStr.split(',');
						// console.log(igurlArr.length);
						return igurlArr;
					}
					
					return [];
				}
			},
			methods:{
				openHomePage : function(){
					var d = this.item;
					var user = d['user'];
					openNewPage('../me/me-homepage.html' , this.user_name , true , {'uid':user['user_id']});
				}
			}
		});

		baseInfo.item = postInfo;
		shareUsername = baseInfo.user_name;
		
		//console.log(JSON.stringify(postInfo));
		
		setTimeout(function(){
			displayImageList(baseInfo.images);
			
			/////帖子详细内容
			var rootdiv = document.getElementById('post-info-id');
			var _content = baseInfo.item['content'];
			var _type = baseInfo.item['type'];
			
			var div1 = document.createElement('div');
			div1.className = 'top-content';
			div1.setAttribute('style',"white-space: pre-wrap;padding-left: 10px;");
			
			switch (category){
				case dt_type_sy:div1.innerText = _content;
				shareContent = _content;
				break;
				case dt_type_zt:
					var div20 = document.createElement('div');
					div20.setAttribute('style',"font-size:18px;color:#333; font-weight:bolder; margin:15px 0;");
					var content_t = _content['title'];
					div20.innerText = content_t;
					
					var div21 = document.createElement('div');
					div21.style.fontSize = '17px';
					var conntetn_s = _content['content'];
					
					shareContent = conntetn_s;
					shareTitle = content_t;
					
					// content.replace(/\n/g," ")
					div21.innerText = conntetn_s.replace(/\$/g,"\n");
					
					div1.appendChild(div20);
					div1.appendChild(div21);
				break;
				
				case dt_type_life:
					var _subTitlePre = '';
				
					if(_type == 21 || _type == 23 || _type == 24 || _type == 25){
						var subContent;
						var _subType = _content['type'];
						console.log(_subType);
						
						switch (_type){
							case '21':
							subContent = _subType ? '招聘' : '找工作';break;
							
							case '23':
							subContent = _subType ? '我是女生' : '我是男生';break;
							
							case '24':
							subContent = _subType ? '我要找房' : '我是房主';break;
							
							case '25':
							subContent = _subType ? '人找车' : '车找人';break;
							default:break;
						}
						
						var div_subtype  = document.createElement('div');
						div_subtype.setAttribute('style','margin-top:25px;');
						
						var span_subtype = document.createElement('span');
						span_subtype.setAttribute('style','color:white;font-size:15px;margin-top:5px;background-color:#ff6000;padding:5px 10px;border-radius:5px;');
						span_subtype.innerText = subContent;
						div_subtype.appendChild(span_subtype);
						div1.appendChild(div_subtype);
						
						_subTitlePre = '(' + subContent + ')';
					}//含有title
					
					var div20 = document.createElement('div');
					div20.setAttribute('style',"font-size:18px;color:#333; font-weight:bolder;color:#333;  margin:25px 0;");
					div20.innerText = _content['title'];
					
					var div21 = document.createElement('div');
					div21.style.fontSize = '17px';
					
					var conntetn_s = _content['content'];
					div21.innerText = conntetn_s.replace(/\$/g,"\n");
					//div21.innerText = _content['content'];
					shareTitle = _subTitlePre + _content['title'];
					shareContent = conntetn_s;
					
					
					div1.appendChild(div20);
					div1.appendChild(div21);
				break;
				
				default:break;
			}
			
			
			rootdiv.appendChild(div1);
			
		} , 10);
		
		///bottom-bar 只有评论数
		var bottomBar_v = new Vue({
			el:"#bottom-bar-id",
			data:{
				item:{}
			}
		});
		
		////评论列表
		var comment_v = new Vue({
			el:"#comment-list-id",
			data:{
				items:[],
				nodata:false
			},
			methods:{
				openHomePage : function(item){
					var d = item;
					console.log(JSON.stringify(item));
					
					openNewPage('../me/me-homepage.html' , item['u_name'] || item['u_nickName'] , true , {'uid':item['uid']});
				}
			}
		});
		
		///是否收藏
		var sc_v = new Vue({
			el:"#sc-button-id",
			data:{
				item:{}
			}
		})
		
		function _commentDataConvert(arr){
			var _new = [];
			for (var i = 0; i < arr.length; i++) {
				var obj = arr[i];
				obj['user_name'] = obj["u_name"] || obj['u_nickName'];
				obj['avatar'] = obj['u_avatar'] || "../../images/default_avatar.png";
				obj['postDate'] = dateUtils.format(obj['date']);
				_new.push(obj);
			}
			return _new;
		}
		
		
		loadComment();
		loadDtDetail();
		
		//获取阅读量,点赞,收藏
		function loadDtDetail(){
			var d = {"pid":postInfo['pid'],
				"type":"0",
                "category":category
			}
			if(postInfo['issh']){//是否是审核操作
				d['issh'] = 1;
			}
			
			if(_myId){d['uid'] = _myId;}
			
			api_post(detail_url,d,function(res){
				sc_v.item = {'issc':res['sc']};
				issc = res['sc'] == 1;
				
				//zan-number-id设置点赞数
				setZanNumber(res['praiseCnt'] || '');
				iszan = res['isPraised'];
				setZanIcon(iszan);
			},function(error){
				
			})
		}
		
		//添加取消收藏
		document.getElementById('sc-button-id').addEventListener('tap',function(){
			if(!userHasLogined()){hud_toast('请先登录');return;}
			
			var d = {"pid":postInfo['pid'],
				"type":issc ? "3" : "2",
				"uid":_myId,
				'subType':'10',
				"category":category
			}
			
			hud_show('请求中');
			api_post(detail_url,d,function(res){
				issc = !issc;
				sc_v.item = {'issc':issc};
				hud_close(issc ? '收藏成功!' : '已取消');
			},function(error){
				hud_close(error || '操作失败,请稍后重试!');
			})
		})
		
		//分享操作
		document.getElementById('share-id').addEventListener('tap',function(){
			shareShow();
		} , false);
		
		//获取分享服务
		plus.share.getServices(function(s){//
			shares={};
			for(var i in s){
				var t=s[i];
				shares[t.id]=t;
			}
		}, function(e){
			outSet('获取分享服务列表失败：'+e.message);
		});
		
			// 打开分享
		function shareShow(){
			var shareBts=[];
			// 更新分享列表
			var ss=shares['weixin'];
			ss&&ss.nativeClient&&(shareBts.push({title:'微信朋友圈',s:ss,x:'WXSceneTimeline'}),
			shareBts.push({title:'微信好友',s:ss,x:'WXSceneSession'}));
			
			ss=shares['qq'];
			ss&&ss.nativeClient&&shareBts.push({title:'QQ',s:ss});
			// 弹出分享列表
			shareBts.length>0?plus.nativeUI.actionSheet({title:'分享到',cancel:'取消',buttons:shareBts}, function(e){
				(e.index>0)&&shareAction(shareBts[e.index-1],true);
			}):plus.nativeUI.alert('当前环境无法支持分享操作!');
		}
		
		/**
		   * 分享操作
		   * @param {JSON} sb 分享操作对象s.s为分享通道对象(plus.share.ShareService)
		   * @param {Boolean} bh 是否分享链接
		   */
		function shareAction(sb,bh) {
			// console.log('shareContent:' + shareContent);
			// console.log('shareTitle:' + shareTitle);
			if(!sb||!sb.s){console.log('无效的分享服务！');return;}
			
			if(shareContent && shareContent.length > 50){
				shareContent = shareContent.substring(0 , 50);
			}
			
			var msg={content:shareContent,extra:{scene:sb.x}};
			if(bh){
				var s = '?' + 'c=' + category + '&id=' + postInfo['pid'];
				msg.href= 'http://dancheng0394.com/tt/p/d.html' + s;
				msg.title= shareTitle || shareContent;//'郸城新动态';
				msg.thumbs=["../../images/new/app_logo60.png"];
				msg.pictures=["../../images/new/app_logo60.png"];
			}
			
			
		// 	var msg={content:'专注本地生活信息服务，关注分享身边新动态，赶快告诉身边的小伙伴吧!',extra:{scene:sb.x}};
		// if(bh){
		// 	msg.href= 'http://dancheng0394.com/a/d/downloadapk.html';
		// 	msg.title='郸城人自己的手中APP';
		// 	msg.thumbs=["../../images/new/app_logo60.png"];
		// 	msg.pictures=["../../images/new/app_logo60.png"];
		// }
		
			// 发送分享
			if(sb.s.authenticated){
				console.log('---已授权---');
				shareMessage(msg, sb.s);
			}else{
				console.log('---未授权---');
				sb.s.authorize(function(){
					shareMessage(msg,sb.s);
				}, function(e){
					console.log('认证授权失败：'+e.code+' - '+e.message);
				});
			}
		}
		
		/**
		   * 发送分享消息
		   * @param {JSON} msg
		   * @param {plus.share.ShareService} s
		   */
		function shareMessage(msg, s){
			s.send(msg, function(){
				console.log('分享到"'+s.description+'"成功！');
				if(userHasLogined()){
					var d = {"uid":getLoginUid(), "type":"1","score":add_score_share};
					api_post(update_profile_url , d , function(res){
						hud_toast('分享成功，积分+' + add_score_share);
						// getUserProfile();
					} );
				}else{
					hud_toast('分享成功，感谢你的支持和关注!');
				}
		
			}, function(e){
				hud_close('分享到"'+s.description+'"失败: '+JSON.stringify(e));
				console.log('分享到"'+s.description+'"失败: '+JSON.stringify(e));
			});
		}
		
		
		///方法操作声明
		window.addEventListener('refresh-comment-event' , function(){
			commentPageNum = 1;
			loadComment();
		});
		
		//获取评论
		function loadComment(){
			var d = {"type":"get",
                 "pid":postInfo['pid'],
                 "category":category,
                 "pageNumber":commentPageNum};
			
			var hasLogin = userHasLogined();	 
			if(hasLogin){//..是否登录过
				d['uid'] = getLoginUid();
			}	 
			
			api_post(comment_url , d , function(res){
				if(res.length > 0){
					var _new =  _commentDataConvert(res);
					comment_v.nodata = true;
					comment_v.items = _new;
					//显示评论数
					bottomBar_v.item = {'cnt':res.length};
					// console.log(JSON.stringify(res[0]));
				}else{
					comment_v.nodata = false;
					console.log('no comment');
				}
			},function(error){
				console.log(error);
			})
		}
		

		
		///评论点赞
		mui('#write-comment-id')[0].addEventListener('tap',function(){
		  //不能控制字数,不能监听事件
		  /*plus.nativeUI.prompt('请输入' , function(e){
			  if(e.index == 0){
				  console.log('提交评论');
			  }
		  },'', "认真评论是一种生活态度", ["提交","取消"])*/
		  
		  //是否登录
		  if(!userHasLogined()){hud_toast('请先登录');return;}
		  
		  //单独页面去评论
		  openNewPage('../publish/pub-comment.html','写评论',true , {'dtInfo':postInfo , 'category':category});
		})
		
		
		//显示图片列表
		function displayImageList(imagesArr){
			var _divi = 3.0;
// 			if(imagesArr.length == 1){
// 				_divi = 1.0;
// 			}else if(imagesArr.length == 2){
// 				_divi = 2.0;
// 			}
			
			var _width = (plus.screen.resolutionWidth - 60) / _divi;
			var root = document.getElementById('image-list');
			for (var i = 0; i < imagesArr.length; i++) {
				var url = imagesArr[i];
				
				var thumbUrl = getDtImageUrl(url , '../../images/default_image2@2x.png');
				var div = document.createElement('div');
				div.className = 'image-wrap';
				div.style.width = _width + 'px';
				div.style.height = (_width) + 'px';
				div.id = 'image-index-' + i;
				
				var div_ig = document.createElement('div');
				div_ig.style.height = _width + 'px';
				
				var ig = document.createElement('img');
				ig.className = 'single-image';
				ig.style.width = _width + 'px';
				ig.style.height = (_width) + 'px';
				
				ig.setAttribute('src' , thumbUrl);
				div_ig.appendChild(ig);
				div.appendChild(div_ig);
				
				div.addEventListener('tap' , function(){
					var s = this.id;
					var imgIndex = 0;
					if(s){
						var _index = s.substr(s.length - 1 , 1);
						imgIndex = Number(_index);
					}
					
					plus.nativeUI.previewImage(imagesArr , {'current':imgIndex , 'indicator':'number'});
				});
				
				root.appendChild(div);
			}
		}
	})//plus
	
	//联系我们
	function connectUsAction(index){
		if(index == 0){
			var d = {"pid":postInfo['pid'],"category":category};		
			openNewPage('../publish/pub-jubao.html' , '举报动态' , true , {'info':d});
		}else{
			openNewPage('../me/webpage.html' , '联系我们' , true , {'url':BASE_URL + contactus_url});	
		}
	}
</script>
</body>
</html>